package com.xujl.mvc.utils;

import freemarker.template.Configuration;
import freemarker.template.Template;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Map;

public class TestToViewModel {

    public static void main(String[] args) throws Exception{

        Configuration cfg = new Configuration();
        cfg.setDirectoryForTemplateLoading(new File("C:\\Users\\XL2001\\IdeaProjects\\pl\\src\\com\\generatecode\\code\\"));


        Template template = cfg.getTemplate("\\ViewModel.java.ftl");

        OutputStream out = new FileOutputStream(new File("C:\\Users\\XL2001\\IdeaProjects\\pl\\src\\com\\generatecode\\code\\11.java"));


        Map<String, Object> root = new HashMap<String, Object>();


        root.put("packageName","test");

        root.put("viewmodelclass","11");


        template.process(root, new OutputStreamWriter(out));



   }
}
